package com.sinosoft.cpyy.service.user.impl;

import com.sinosoft.cpyy.dao.master.UsersMapper;
import com.sinosoft.cpyy.model.Users;
import com.sinosoft.cpyy.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 创建时间：2018/三月/27
 *
 * @author 张政[zhang_zheng@sinosoft.com.cn]
 * 类名：UserServiceImpl
 * 描述：用户信息操作API
 */
@Service
public class UserServiceImpl implements UserService {

    private final UsersMapper usersMapper;

    @Autowired
    public UserServiceImpl(UsersMapper usersMapper) {
        this.usersMapper = usersMapper;
    }

    //2.2查询用户数据 实现
    @Override
    public List<Users> findUserInfo() {
        //2.3查询用户数据Dao（数据持久层）
        List<Users> findUserInfo = usersMapper.findUserInfo();
        return findUserInfo;
    }

    @Override
    public int deleteByPrimaryKey(String userId) {
        // TODO Auto-generated method stub
        return usersMapper.deleteByPrimaryKey(userId);
    }

    /**
     * 查询用户名-密码--接口
     *
     * @param users 用户信息
     * @return 返回用户信息
     */
    @Override
    public Users findByUser(Users users) {
        return usersMapper.findByUser(users);
    }

}
